package com.ibeeking.found.common.enums;

/**
 * @ClassName: PaymentWayOmsEnum
 * @Author ibeeking
 * @Date: 2021/6/23 09:22
 * @Description: TODO
 */
public enum PaymentWayOmsEnum {
    /**
     * 现金
     */
    CASH(0, "现金"),

    /**
     * 支付宝
     */
    ZFB(1, "支付宝"),

    /**
     * 微信
     */
    WX(2, "微信"),

    /**
     * 银联
     */
    YL(4, "银联"),

    /**
     * 捷钱包
     */
    JYF(5, "捷钱包"),

    /**
     * 易付宝
     */
    YFB(6, "易付宝"),

    /**
     * 翼支付
     */
    YZF(7, "翼支付"),

    /**
     *
     */
    XJ(8, "现金"),

    OTHER(9, "其他"),
    ;

    private Integer code;
    private String name;

    PaymentWayOmsEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

    public static String getNameByCode(Integer code) {
        for (PaymentWayOmsEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static Integer getCodeByName(String name) {
        for (PaymentWayOmsEnum enumObj : values()) {
            if (enumObj.getName().equals(name)) {
                return enumObj.getCode();
            }
        }
        return null;
    }
}
